home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / loadavg / loadavg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-01  |  2.3 KB  |  113 lines

  1. /*
  2.  * loadAvg.h --
  3.  *
  4.  *    Declarations internal to the loadavg program.
  5.  *
  6.  * Copyright 1987 Regents of the University of California
  7.  * All rights reserved.
  8.  *
  9.  *
  10.  * $Header: /a/newcmds/loadavg/RCS/loadavg.h,v 1.7 89/07/31 17:51:57 douglis Exp $ SPRITE (Berkeley)
  11.  */
  12.  
  13. #ifndef _LOADAVG
  14. #define _LOADAVG
  15.  
  16. #include <time.h>
  17. #include <db.h>
  18. #include <mig.h>
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21.  
  22. #include <proc.h>
  23. #include <kernel/net.h>
  24.  
  25. /*
  26.  * Subscripts into the queueThreshold array.
  27.  */
  28. #define MIN_THRESHOLD 0
  29. #define MAX_THRESHOLD 1
  30.  
  31. /*
  32.  * Arbitrary value larger than the load average on any node (we hope!)
  33.  */
  34. #define MAX_LOAD 1000.0
  35.  
  36. /*
  37.  * Buffer lengths.
  38.  */
  39. #define HOST_NAME_SIZE 64
  40. #define MAX_PATH_NAME_LENGTH 1024
  41.  
  42.  
  43. /*
  44.  * For each machine, keep track of the timestamp for its information and the
  45.  * different load averages reported.   Also, the architecture type
  46.  * (e.g., sun2/sun3/spur) is stored to make sure we can migrate to a machine
  47.  * of the same type.
  48.  */
  49.  
  50. /*
  51.  * If we are not allowing foreign processes, but our time since last input
  52.  * is greater than noInput and our average queue lengths are ALL less than
  53.  * the corresponding values in min, start accepting foreign processes.
  54.  *
  55.  * If we are allowing foreign processes and either the idle time drops
  56.  * or ANY of the average queue lengths exceeds its corresponding value in max,
  57.  * stop accepting them.
  58.  */
  59.  
  60. typedef struct {
  61.     int        noInput;
  62.     double    min[MIG_NUM_LOAD_VALUES];
  63.     double    max[MIG_NUM_LOAD_VALUES];
  64. } Thresholds;
  65.  
  66. typedef enum {
  67.     EVICT,
  68.     CHECK_COUNT
  69. } FindForeignParam;
  70.  
  71. /*
  72.  * Global variables.  (Options, plus other global vars initialized at startup.)
  73.  */
  74.  
  75. extern int debug;
  76. extern int verbose;
  77. extern int loadInterval;
  78. extern int writeInterval;
  79. extern int timeOut;
  80. extern int neverAccept;
  81. extern int alwaysAccept;
  82. extern int migVersion;
  83. extern int numLowPris;
  84. extern int useKernelIdleTime;
  85. extern char *dataFile;
  86. extern char *weightString;
  87. extern double weights[];
  88. extern Thresholds thresholds;
  89.  
  90. extern int errno;
  91.  
  92. extern int hostID;
  93. extern char *myName;
  94. extern char hostname[];
  95. extern char *machType;
  96. extern int kernelState;
  97. #ifdef INTERIM
  98. extern int oldKernel;
  99. #endif /* INTERIM */
  100.  
  101. /*
  102.  * Procedures.
  103.  */
  104.  
  105. extern void RunDaemon();
  106. extern int FindForeign();
  107.  
  108. extern char *malloc();
  109. extern char *strcpy();
  110. extern char *strerror();
  111. #endif _LOADAVG
  112.  
  113.